"""有以下两个字典
请合并这两个字典，并打印出来。(有相同键时，取其值更大的。)
最后结果应为{'a': 10, 'b': 8, 'c': 4, 'd': '7'} """

dict1 = {'a': 10, 'b': 8, 'c': 7}
dict2 = {'a': 11, 'b': 4, 'c': 6, 'd': 6}


# new_dict = dict(dict2, **dict1)
# print(new_dict)

for key, value in dict2.items():
    if key in dict1:
        dict1[key] = max(dict1[key], value)
    else:
        dict1[key] = value

print(dict1)






